Optimal. Leaf size=115 \[ -\frac {2 \left (a^2-2 b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^3 \sqrt {a^2-b^2} d}+\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}-\frac {2 \cot (c+d x)}{a^2 d}+\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.29, antiderivative size = 115, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2802, 3135,
3080, 3855, 2739, 632, 210} \begin {gather*} \frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}-\frac {2 \cot (c+d x)}{a^2 d}-\frac {2 \left (a^2-2 b^2\right ) \text {ArcTan}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a^3 d \sqrt {a^2-b^2}}+\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 632
Rule 2739
Rule 2802
Rule 3080
Rule 3135
Rule 3855
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x)}{(a+b \sin (c+d x))^2} \, dx &=\int \frac {\csc ^2(c+d x) \left (1-\sin ^2(c+d x)\right )}{(a+b \sin (c+d x))^2} \, dx\\ &=\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}+\frac {\int \frac {\csc ^2(c+d x) \left (2 \left (a^2-b^2\right )-\left (a^2-b^2\right ) \sin ^2(c+d x)\right )}{a+b \sin (c+d x)} \, dx}{a \left (a^2-b^2\right )}\\ &=-\frac {2 \cot (c+d x)}{a^2 d}+\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}+\frac {\int \frac {\csc (c+d x) \left (-2 b \left (a^2-b^2\right )-a \left (a^2-b^2\right ) \sin (c+d x)\right )}{a+b \sin (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )}\\ &=-\frac {2 \cot (c+d x)}{a^2 d}+\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}-\frac {(2 b) \int \csc (c+d x) \, dx}{a^3}-\frac {\left (a^2-2 b^2\right ) \int \frac {1}{a+b \sin (c+d x)} \, dx}{a^3}\\ &=\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}-\frac {2 \cot (c+d x)}{a^2 d}+\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}-\frac {\left (2 \left (a^2-2 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^3 d}\\ &=\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}-\frac {2 \cot (c+d x)}{a^2 d}+\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}+\frac {\left (4 \left (a^2-2 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^3 d}\\ &=-\frac {2 \left (a^2-2 b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^3 \sqrt {a^2-b^2} d}+\frac {2 b \tanh ^{-1}(\cos (c+d x))}{a^3 d}-\frac {2 \cot (c+d x)}{a^2 d}+\frac {\cot (c+d x)}{a d (a+b \sin (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.52, size = 139, normalized size = 1.21 \begin {gather*} -\frac {\frac {4 \left (a^2-2 b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+a \cot \left (\frac {1}{2} (c+d x)\right )-4 b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+4 b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {2 a b \cos (c+d x)}{a+b \sin (c+d x)}-a \tan \left (\frac {1}{2} (c+d x)\right )}{2 a^3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.42, size = 156, normalized size = 1.36
method | result | size |
derivativedivides | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}}-\frac {1}{2 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{3}}-\frac {2 \left (\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a b}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+\frac {\left (a^{2}-2 b^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}}\right )}{a^{3}}}{d}\) | \(156\) |
default | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}}-\frac {1}{2 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{3}}-\frac {2 \left (\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a b}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+\frac {\left (a^{2}-2 b^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}}\right )}{a^{3}}}{d}\) | \(156\) |
risch | \(-\frac {2 \left (-3 a \,{\mathrm e}^{i \left (d x +c \right )}+2 i b \,{\mathrm e}^{2 i \left (d x +c \right )}-2 i b +a \,{\mathrm e}^{3 i \left (d x +c \right )}\right )}{\left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}-b +2 i a \,{\mathrm e}^{i \left (d x +c \right )}\right ) a^{2} d}-\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a^{3} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, d a}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right ) b^{2}}{\sqrt {-a^{2}+b^{2}}\, d \,a^{3}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, d a}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right ) b^{2}}{\sqrt {-a^{2}+b^{2}}\, d \,a^{3}}+\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a^{3} d}\) | \(417\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 341 vs.
\(2 (110) = 220\).
time = 0.45, size = 768, normalized size = 6.68 \begin {gather*} \left [\frac {4 \, {\left (a^{3} b - a b^{3}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) - {\left (a^{2} b - 2 \, b^{3} - {\left (a^{2} b - 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} - 2 \, a b^{2}\right )} \sin \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) + 2 \, {\left (a^{4} - a^{2} b^{2}\right )} \cos \left (d x + c\right ) - 2 \, {\left (a^{2} b^{2} - b^{4} - {\left (a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} b - a b^{3}\right )} \sin \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 2 \, {\left (a^{2} b^{2} - b^{4} - {\left (a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} b - a b^{3}\right )} \sin \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, {\left ({\left (a^{5} b - a^{3} b^{3}\right )} d \cos \left (d x + c\right )^{2} - {\left (a^{6} - a^{4} b^{2}\right )} d \sin \left (d x + c\right ) - {\left (a^{5} b - a^{3} b^{3}\right )} d\right )}}, \frac {2 \, {\left (a^{3} b - a b^{3}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) - {\left (a^{2} b - 2 \, b^{3} - {\left (a^{2} b - 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} - 2 \, a b^{2}\right )} \sin \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) + {\left (a^{4} - a^{2} b^{2}\right )} \cos \left (d x + c\right ) - {\left (a^{2} b^{2} - b^{4} - {\left (a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} b - a b^{3}\right )} \sin \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + {\left (a^{2} b^{2} - b^{4} - {\left (a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{3} b - a b^{3}\right )} \sin \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{{\left (a^{5} b - a^{3} b^{3}\right )} d \cos \left (d x + c\right )^{2} - {\left (a^{6} - a^{4} b^{2}\right )} d \sin \left (d x + c\right ) - {\left (a^{5} b - a^{3} b^{3}\right )} d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cot ^{2}{\left (c + d x \right )}}{\left (a + b \sin {\left (c + d x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 21.82, size = 218, normalized size = 1.90 \begin {gather*} -\frac {\frac {12 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a^{3}} - \frac {3 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2}} + \frac {12 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )} {\left (a^{2} - 2 \, b^{2}\right )}}{\sqrt {a^{2} - b^{2}} a^{3}} - \frac {4 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 4 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 14 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2}}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )} a^{3}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.32, size = 1616, normalized size = 14.05 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________